#!/usr/bin/env python
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------#
# ZhihuiJin <zhihuijin@gmail.com>
# vim: ts=4 sw=4 sts=4 et tw=78:
# Fri Dec  8 14:46:39 2006
#
#----------------------------------------------------------------------------#

import os
import hanChar
from www import settings

_structureDir = os.path.join(settings.DATA_DIR, 'structure')
_stroke_file =  os.path.join(_structureDir, 'cjk_stroke_utf8')


#----------------------------------------------------------------------------#
def getStroke(charSet):
    """ get stroke data
    """
    strokeData = [line.strip() for line in open(_stroke_file)]

    strokeDict = {}
    for line in strokeData:
        char, stroke = line.split()
        strokeDict[char] = stroke

    for char in charSet :
        char = char.encode('utf-8')
        stroke = strokeDict.get(char)
        if stroke:
           print char + ' ' + stroke

#----------------------------------------------------------------------------#
if __name__ == "__main__":
    #getStroke(hanChar.getGB2312())
    getStroke(hanChar.getSJIS())

# vim: ts=4 sw=4 sts=4 et tw=78:
